package com.athbsd.exer3;

import org.junit.Test;

import java.util.*;

/**
 * @author zhouzhou
 * @version 1.0
 * @description: TODO
 * @date 2025/2/24 10:25
 */

public class test {
    @Test
    public void Test1(){
        //数组-->集合
        Integer [] arr=new Integer[]{1,2,3,4,5};
        List list= Arrays.asList(arr);
        System.out.println(list.size());
        System.out.println("--------");
        int [] arr1=new int[]{1,2,3,4,5};
        List list1= Arrays.asList(arr1);
        System.out.println(list1.size());
    }

    /**
     * 迭代器
     */
    @Test
    public void Test2(){
        List list=new ArrayList();
        list.add(1);
        list.add(2);
        list.add("tom");
        list.add(new String("zhouzhou"));
//        Iterator iterator=list.iterator();
//        while(iterator.hasNext()){
//            System.out.println(iterator.next());
//        }
        for(Object o:list){
            System.out.println(o);
        }
        list.remove(0);//索引
        list.remove(Integer.valueOf(2));//删除数据2
        list.remove("tom");
        for(Object o:list){
            System.out.println(o);
        }
    }

    @Test
    public void Test3(){

    }
}
